<template>
  <div>
    <el-dialog
      title="节点配置信息"
      class="tasksz"
      :visible.sync="isVisiable"
      width="1400px"
      :close-on-click-modal="false"
      append-to-body
    >
      <div class="containers" ref="content" v-if="isVisiable">
        <el-form
          v-model="taskInfo"
          ref="infoForm"
          label-width="150px"
          label-position="right"
        >
          <el-row>
            <el-col :span="12">
              <el-form-item label="节点编号：">
                <el-input
                  placeholder="节点编号"
                  v-model="taskInfo.taskId"
                  style="width: 200px"
                  :disabled="true"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="!isEnd">
              <el-form-item label="节点名称：">
                <el-input
                  placeholder="节点名称"
                  v-model="taskInfo.taskName"
                  style="width: 200px"
                  :disabled="true"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-if="false" v-show="!isEnd">
              <el-form-item label="节点标识：">
                <el-input
                  placeholder="节点标识"
                  v-model="taskInfo.taskCode"
                  style="width: 200px"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="false" v-show="!isEnd">
            <el-col :span="6">
              <el-form-item label="是否起点：">
                {{ taskInfo.isRoot ? "启动节点" : "流转节点" }}
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="taskInfo.isRoot">
              <!-- <el-form-item label="启动角色：">
                  <el-select  v-model="taskInfo.rootRole" multiple placeholder="请选择"  style="width:750px">
                      <el-option v-for="(item,index) in RoleValue" :key="index" :label="item.roleName" :value="item.roleId">
                      </el-option>
                  </el-select>
              </el-form-item> -->
            </el-col>
            <el-col v-if="false" :span="6">
              <el-form-item label="节点占比：">
                <el-input-number
                  v-model="taskInfo.progress"
                  :precision="2"
                  :step="0.1"
                  :min="0.1"
                  :max="100"
                ></el-input-number>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd">
            <el-col :span="12">
              <el-form-item label="节点类型：">
                <el-select
                  v-model="taskInfo.taskType"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: '普通', label: '普通' },
                      { value: '会签', label: '会签' },
                      // {value:'传阅',label:'传阅'},
                      // {value:'并签',label:'并签'},
                      // {value:'或签',label:'或签'}
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12">
              <el-form-item label="环节办理：">
                <el-select
                  v-model="taskInfo.programInterface"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="item in programInterfaceList"
                    v-if="item.type == mainInfo.sortBusiness"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="taskInfo.taskType == '传阅'">
              <el-form-item label="传阅配置：">
                <el-select
                  v-model="taskInfo.circulateConfig"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in [
                      { value: '节点人员配置', label: '节点人员配置' },
                      { value: '本部门所有人', label: '本部门所有人' },
                      { value: '分管向下一级', label: '分管向下一级' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd">
            <el-col :span="6">
              <el-form-item label="操作类型：">
                <el-select v-model="taskInfo.handleType" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '申请', label: '申请' },
                      { value: '审核', label: '审核' },
                      { value: '审批', label: '审批' },
                      { value: '办理', label: '办理' },
                      { value: '查看', label: '查看' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="按钮名称：">
                <el-select v-model="taskInfo.handleButton" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '申请', label: '申请' },
                      { value: '提交', label: '提交' },
                      { value: '同意', label: '同意' },
                      { value: '完成', label: '完成' },
                      { value: '通过', label: '通过' },
                      { value: '已阅', label: '已阅' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="默认批注：">
                <el-autocomplete
                  class="inline-input"
                  v-model="taskInfo.handleText"
                  :fetch-suggestions="querySearch"
                  placeholder="默认批注"
                  style="width: 200px"
                ></el-autocomplete>
              </el-form-item>
            </el-col>
            <el-col :span="6">
              <el-form-item label="批注开关：">
                <el-select v-model="taskInfo.TextSwitch" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: false, label: '不是必须' },
                      { value: true, label: '必须填写' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="!taskInfo.buttonConfig.length > 0" v-show="false">
            <el-col :span="12" v-show="!isEnd">
              <el-form-item label="按钮开始日期：">
                <el-date-picker
                  v-model="taskInfo.submitUp"
                  type="datetime"
                  placeholder="选择日期"
                  style="width: 200px"
                  format="yyyy-MM-dd HH:mm:ss"
                  value-format="yyyy-MM-dd HH:mm:ss"
                ></el-date-picker>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="!isEnd">
              <el-form-item label="按钮结束日期：">
                <el-date-picker
                  v-model="taskInfo.submitEnd"
                  type="datetime"
                  placeholder="选择日期"
                  style="width: 200px"
                  format="yyyy-MM-dd HH:mm:ss"
                  value-format="yyyy-MM-dd HH:mm:ss"
                ></el-date-picker>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd">
            <el-col :span="4">
              <el-form-item label="按钮配置：">
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  style="margin-left: 5px"
                  @click="buttonAdd"
                ></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <div
                v-for="(item, index) in taskInfo.buttonConfig"
                :key="index"
                style="margin-bottom: 20px"
              >
                按钮名称:
                <el-input
                  placeholder="按钮名称"
                  v-model="item.buttonName"
                  style="width: 200px; margin-right: 10px"
                ></el-input>
                按钮类型:
                <el-select
                  v-model="item.buttonType"
                  placeholder="请选择"
                  style="width: 200px; margin-right: 10px"
                >
                  <el-option
                    v-for="item1 in [
                      { value: '传递', label: '传递' },
                      { value: '保存', label: '保存' },
                    ]"
                    :key="item1.value"
                    :label="item1.label"
                    :value="item1.value"
                  >
                  </el-option>
                </el-select>
                <span v-show="item.buttonType == '传递'">
                  传递节点:
                  <el-select
                    v-model="item.taskId"
                    placeholder="请选择"
                    style="width: 200px; margin-right: 10px"
                  >
                    <el-option
                      v-for="item in taskList"
                      :key="item.value"
                      :label="item.label + '(' + item.value + ')'"
                      :value="item.value"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-show="item.buttonType == '程序'">
                  程序名称:
                  <el-input
                    placeholder="程序名称"
                    v-model="item.praName"
                    style="width: 200px; margin-right: 10px"
                  ></el-input>
                </span>
                <el-button
                  type="primary"
                  icon="el-icon-minus"
                  @click="buttonRemove(index)"
                ></el-button>
                <span v-show="false">
                  <br />
                  按钮开始日期：<el-date-picker
                    v-model="item.submitUp"
                    type="datetime"
                    placeholder="选择日期"
                    style="width: 200px"
                    format="yyyy-MM-dd HH:mm:ss"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  ></el-date-picker>
                  按钮结束日期：<el-date-picker
                    v-model="item.submitEnd"
                    type="datetime"
                    placeholder="选择日期"
                    style="width: 200px"
                    format="yyyy-MM-dd HH:mm:ss"
                    value-format="yyyy-MM-dd HH:mm:ss"
                  ></el-date-picker>
                </span>
              </div>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd">
            <el-col :span="6">
              <el-form-item label="退回开关：">
                <el-select
                  v-model="taskInfo.backSwitch"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: false, label: '不可退回' },
                      { value: true, label: '可以退回' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-show="taskInfo.backSwitch == true">
              <el-form-item label="退回模式：">
                <el-select v-model="taskInfo.backMode" placeholder="请选择">
                  <el-option label="单退模式" :value="false"></el-option>
                  <el-option label="多退模式" :value="true"></el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="taskInfo.backSwitch == true">
              <el-form-item label="退回配置：">
                <el-select
                  v-model="taskInfo.backList"
                  multiple
                  placeholder="请选择"
                  style="width: 400px"
                >
                  <el-option
                    v-for="item in taskList"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd">
            <el-col :span="6">
              <el-form-item label="撤销开关：">
                <el-select v-model="taskInfo.revokeSwitch" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: false, label: '不可撤销' },
                      { value: true, label: '可以撤销' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-if="false">
              <el-form-item label="撤回开关：">
                <el-select
                  v-model="taskInfo.recallSwitch"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: false, label: '不可撤回' },
                      { value: true, label: '可以撤回' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-if="false">
              <el-form-item label="去重开关：">
                <el-select v-model="taskInfo.skipSwitch" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: false, label: '不可去重' },
                      { value: true, label: '可以去重' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="12">
              <el-form-item label="转办开关：">
                <el-select
                  v-model="taskInfo.transferSwitch"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in [
                      { value: false, label: '不可转办' },
                      { value: true, label: '可以转办' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="taskInfo.transferSwitch == true">
              <el-form-item label="转办配置：">
                <el-select
                  v-model="taskInfo.transferConfig"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in [
                      { value: '节点人员配置', label: '节点人员配置' },
                      { value: '本部门所有人', label: '本部门所有人' },
                      { value: '分管向下一级', label: '分管向下一级' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd">
            <el-col :span="6">
              <el-form-item label="人员配置：">
                <el-select
                  v-model="taskInfo.personnelConfig.type"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: '', label: '无' },
                      { value: '角色', label: '角色' },
                      { value: '单位角色', label: '单位角色' },
                      { value: '部门角色', label: '部门角色' },
                      // {value:'指定角色',label:'指定角色'},
                      { value: '发起人相关', label: '发起人相关' },
                      { value: '办理人相关', label: '办理人相关' },
                      { value: '节点相关', label: '节点相关' },
                      { value: '指定人员', label: '指定人员' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="18">
              <!-- <el-form-item label="部门配置：" v-show="taskInfo.personnelConfig.type=='部门'">
                  <el-input :value="getDeptNames(taskInfo.personnelConfig.depts)" @click.native="SelectDept('ryBmId','ryBmName',taskInfo.personnelConfig.depts)" :readonly="true"></el-input>
              </el-form-item>
              <el-form-item label="人员配置：" v-show="taskInfo.personnelConfig.type=='人员'">
                  <el-input :value="getUserNames(taskInfo.personnelConfig.users)" @click.native="SelectPeople('ryUserId',taskInfo.personnelConfig.users)" readonly="readonly" ></el-input>
              </el-form-item> -->
              <el-form-item
                label="角色配置："
                v-show="taskInfo.personnelConfig.type == '角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.roles"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="单位角色："
                v-show="taskInfo.personnelConfig.type == '单位角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.rolesDw"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="部门角色"
                v-show="taskInfo.personnelConfig.type == '部门角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.rolesBm"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="指定角色："
                v-show="taskInfo.personnelConfig.type == '指定角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.rolesZd"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="发起人相关："
                v-show="taskInfo.personnelConfig.type == '发起人相关'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.originator"
                  multiple
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in originatorList"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="办理人相关："
                v-show="taskInfo.personnelConfig.type == '办理人相关'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.transactor"
                  multiple
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in transactorList"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="节点相关："
                v-show="taskInfo.personnelConfig.type == '节点相关'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig.tasks"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in tasksList"
                    :key="index"
                    :label="item.taskName + '(' + item.taskId + ')'"
                    :value="item.taskId"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="指定人员："
                v-show="taskInfo.personnelConfig.type == '指定人员'"
              >
                <span v-if="taskInfo.personnelConfig.users.length > 0">
                  {{ taskInfo.personnelConfig.users[0].ryName }}
                </span>
                <span v-else> 未指定 </span>
                <el-button
                  style="margin-left: 20px"
                  @click="selectUser(taskInfo.personnelConfig.users)"
                  >选择人员
                </el-button>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="6">
              <el-form-item label="人员配置2：">
                <el-select
                  v-model="taskInfo.personnelConfig2.type"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: '', label: '无' },
                      { value: '角色', label: '角色' },
                      { value: '单位角色', label: '单位角色' },
                      { value: '部门角色', label: '部门角色' },
                      // {value:'指定角色',label:'指定角色'},
                      { value: '发起人相关', label: '发起人相关' },
                      { value: '办理人相关', label: '办理人相关' },
                      { value: '节点相关', label: '节点相关' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="18">
              <!-- <el-form-item label="部门配置：" v-show="taskInfo.personnelConfig2.type=='部门'">
                  <el-input :value="getDeptNames(taskInfo.personnelConfig2.depts)" @click.native="SelectDept('ryBmId','ryBmName',taskInfo.personnelConfig2.depts)" :readonly="true"></el-input>
              </el-form-item>
              <el-form-item label="人员配置：" v-show="taskInfo.personnelConfig2.type=='人员'">
                  <el-input :value="getUserNames(taskInfo.personnelConfig2.users)" @click.native="SelectPeople('ryUserId',taskInfo.personnelConfig2.users)" readonly="readonly" ></el-input>
              </el-form-item> -->
              <el-form-item
                label="角色配置："
                v-show="taskInfo.personnelConfig2.type == '角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.roles"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="单位角色："
                v-show="taskInfo.personnelConfig2.type == '单位角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.rolesDw"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="部门角色"
                v-show="taskInfo.personnelConfig2.type == '部门角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.rolesBm"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="指定角色："
                v-show="taskInfo.personnelConfig2.type == '指定角色'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.rolesZd"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="发起人相关："
                v-show="taskInfo.personnelConfig2.type == '发起人相关'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.originator"
                  multiple
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in originatorList"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="办理人相关："
                v-show="taskInfo.personnelConfig2.type == '办理人相关'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.transactor"
                  multiple
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in transactorList"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="节点相关："
                v-show="taskInfo.personnelConfig2.type == '节点相关'"
              >
                <el-select
                  v-model="taskInfo.personnelConfig2.tasks"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in tasksList"
                    :key="index"
                    :label="item.taskName + '(' + item.taskId + ')'"
                    :value="item.taskId"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="4">
              <el-form-item label="附件配置：">
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  style="margin-left: 5px"
                  @click="fjAdd"
                ></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <div
                v-for="(item, index) in taskInfo.attachFileConfig"
                :key="index"
                style="margin-bottom: 20px"
              >
                附件名称:
                <el-input
                  placeholder="附件标准"
                  v-model="item.fjName"
                  style="width: 200px; margin-right: 10px"
                ></el-input>
                类型验证:
                <el-select
                  v-model="item.fjLx"
                  placeholder="请选择"
                  multiple
                  style="width: 362px; margin-right: 10px"
                >
                  <el-option
                    v-for="item in [
                      { value: 'PDF', label: 'PDF' },
                      { value: '图片', label: '图片' },
                      { value: '文档', label: '文档' },
                      { value: '表格', label: '表格' },
                      { value: '压缩包', label: '压缩包' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
                是否必选:
                <el-select
                  v-model="item.fjXz"
                  placeholder="请选择"
                  style="width: 80px; margin-right: 10px"
                >
                  <el-option
                    v-for="item in [
                      { value: '是', label: '是' },
                      { value: '否', label: '否' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
                <!-- 是否盖章:
                <el-select v-model="item.fjGz" placeholder="请选择"  style="width:80px;margin-right: 10px">
                    <el-option
                        v-for="item in [
                            {value:'是',label:'是'},
                            {value:'否',label:'否'},
                        ]"
                        :key="item.value"
                        :label="item.label"
                        :value="item.value">
                    </el-option>
                </el-select> -->
                <el-button
                  type="primary"
                  icon="el-icon-minus"
                  @click="fjRemove(index)"
                ></el-button>
              </div>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="12">
              <el-form-item label="附件高度：">
                <el-input-number
                  v-model="taskInfo.attachmentHeight"
                  :min="0"
                  :max="300"
                ></el-input-number>
                px
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="4">
              <el-form-item label="验证配置：">
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  style="margin-left: 5px"
                  @click="yzAdd"
                  v-show="taskInfo.verificationConfig.length == 0"
                ></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <div
                v-for="(item, index) in taskInfo.verificationConfig"
                :key="index"
                style="margin-bottom: 20px"
              >
                验证类型:
                <el-select
                  v-model="item.yzLx"
                  placeholder="请选择"
                  style="width: 200px; margin-right: 10px"
                >
                  <!-- {value:'自定义',label:'自定义'}, -->
                  <el-option
                    v-for="item in [
                      { value: '前端', label: '前端' },
                      { value: '后端', label: '后端' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
                <span v-if="item.yzLx == '前端'">
                  前端方法:
                  <el-input
                    placeholder="前端方法"
                    v-model="item.frontApi"
                    style="width: 300px; margin-right: 10px"
                  ></el-input>
                </span>
                <span v-else-if="item.yzLx == '后端'">
                  后端接口:
                  <el-input
                    placeholder="后端接口"
                    v-model="item.backApi"
                    style="width: 300px; margin-right: 10px"
                  ></el-input>
                </span>
                <span v-else-if="item.yzLx == '自定义'">
                  &emsp;JS代码:
                  <el-input
                    placeholder="JS代码"
                    v-model="item.zdy"
                    type="textarea"
                    :autosize="{ minRows: 2, maxRows: 4 }"
                    style="width: 500px; margin-right: 10px"
                  ></el-input>
                </span>
                <el-button
                  type="primary"
                  icon="el-icon-minus"
                  @click="yzRemove(index)"
                ></el-button>
              </div>
            </el-col>
          </el-row>
          <el-row v-if="false">
            <el-col :span="6">
              <el-form-item label="主抄配置：">
                <el-select
                  v-model="taskInfo.copyInfoConfig.type"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in [
                      { value: '', label: '无' },
                      { value: '角色', label: '角色' },
                      { value: '单位角色', label: '单位角色' },
                      { value: '部门角色', label: '部门角色' },
                      { value: '指定角色', label: '指定角色' },
                      { value: '发起人相关', label: '发起人相关' },
                      { value: '办理人相关', label: '办理人相关' },
                      { value: '节点相关', label: '节点相关' },
                      { value: '人员', label: '人员' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="18">
              <!-- <el-form-item label="部门配置：" v-show="taskInfo.copyInfoConfig.type=='部门'">
                  <el-input :value="getDeptNames(taskInfo.copyInfoConfig.depts)" @click.native="SelectDept('csBmId','csBmName',taskInfo.copyInfoConfig.depts)" :readonly="true"></el-input>
              </el-form-item> -->
              <el-form-item
                label="人员配置："
                v-show="taskInfo.copyInfoConfig.type == '人员'"
              >
                <el-input
                  :value="getUserNames(taskInfo.copyInfoConfig.users)"
                  @click.native="
                    SelectPeople(
                      'copyInfoConfig',
                      0,
                      taskInfo.copyInfoConfig.users
                    )
                  "
                  readonly="readonly"
                  style="width: 750px"
                ></el-input>
              </el-form-item>
              <el-form-item
                label="角色配置："
                v-show="taskInfo.copyInfoConfig.type == '角色'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.roles"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="单位角色："
                v-show="taskInfo.copyInfoConfig.type == '单位角色'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.rolesDw"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="部门角色："
                v-show="taskInfo.copyInfoConfig.type == '部门角色'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.rolesBm"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="指定角色："
                v-show="taskInfo.copyInfoConfig.type == '指定角色'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.rolesDw"
                  multiple
                  placeholder="请选择"
                  style="width: 750px"
                >
                  <el-option
                    v-for="(item, index) in RoleValue"
                    :key="index"
                    :label="item.roleName"
                    :value="item.roleId"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="发起人相关："
                v-show="taskInfo.copyInfoConfig.type == '发起人相关'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.originator"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in originatorList"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="办理人相关："
                v-show="taskInfo.copyInfoConfig.type == '办理人相关'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.transactor"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in transactorList"
                    :key="index"
                    :label="item.name"
                    :value="item.id"
                  ></el-option>
                </el-select>
              </el-form-item>
              <el-form-item
                label="节点相关："
                v-show="taskInfo.copyInfoConfig.type == '节点相关'"
              >
                <el-select
                  v-model="taskInfo.copyInfoConfig.tasks"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="(item, index) in tasksList"
                    :key="index"
                    :label="item.taskName + '(' + item.taskId + ')'"
                    :value="item.taskId"
                  ></el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="false">
            <el-col :span="4">
              <el-form-item label="副抄配置：">
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  style="margin-left: 5px"
                  @click="cslistAdd"
                ></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <div
                v-for="(item, index) in taskInfo.copyInfoConfigList"
                :key="index"
                style="margin-bottom: 20px"
              >
                抄送范围:
                <el-select v-model="item.type" placeholder="请选择">
                  <el-option
                    v-for="item1 in [
                      { value: '', label: '无' },
                      { value: '角色', label: '角色' },
                      { value: '单位角色', label: '单位角色' },
                      { value: '部门角色', label: '部门角色' },
                      { value: '指定角色', label: '指定角色' },
                      { value: '发起人相关', label: '发起人相关' },
                      { value: '办理人相关', label: '办理人相关' },
                      { value: '节点相关', label: '节点相关' },
                      { value: '兼职相关', label: '兼职相关' },
                      { value: '人员', label: '人员' },
                    ]"
                    :key="item1.value"
                    :label="item1.label"
                    :value="item1.value"
                  >
                  </el-option>
                </el-select>

                <!-- <span v-if="item.qdRole.type=='部门'">
                    部门配置：
                    <el-input :value="getDeptNames(item.qdRole.depts)" @click.native="SelectDept(index,'qdBmName',item.qdRole.depts)" :readonly="true" style="width:200px"></el-input>
                </span> -->
                <span v-if="item.type == '人员'">
                  人员配置：
                  <el-input
                    :value="getUserNames(item.users)"
                    @click.native="
                      SelectPeople('copyInfoConfigList', index, item.users)
                    "
                    readonly="readonly"
                    style="width: 200px"
                  ></el-input>
                </span>
                <span v-else-if="item.type == '角色'">
                  角色配置：
                  <el-select
                    v-model="item.roles"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '单位角色'">
                  单位角色：
                  <el-select
                    v-model="item.rolesDw"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '部门角色'">
                  部门角色：
                  <el-select
                    v-model="item.rolesBm"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '兼职相关'">
                  兼职相关：
                  <el-select
                    v-model="item.rolesBm"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '指定角色'">
                  指定角色：
                  <el-select
                    v-model="item.rolesZd"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '发起人相关'">
                  发起人相关：
                  <el-select
                    v-model="item.originator"
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in originatorList"
                      :key="index"
                      :label="item.name"
                      :value="item.id"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '办理人相关'">
                  办理人相关：
                  <el-select
                    v-model="item.transactor"
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in transactorList"
                      :key="index"
                      :label="item.name"
                      :value="item.id"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.type == '节点相关'">
                  节点相关：
                  <el-select
                    v-model="item.tasks"
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in tasksList"
                      :key="index"
                      :label="item.taskName + '(' + item.taskId + ')'"
                      :value="item.taskId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <el-button
                  type="primary"
                  icon="el-icon-minus"
                  style="margin-left: 10px"
                  @click="cslistRemove(index)"
                ></el-button>
              </div>
            </el-col>
          </el-row>
          <el-row v-if="false">
            <el-col :span="4">
              <el-form-item label="触发后续：">
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  style="margin-left: 5px"
                  @click="cfApiAdd"
                  :disabled="taskInfo.triggerConfig.length != 0"
                ></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <div
                v-for="(item, index) in taskInfo.triggerConfig"
                :key="index"
                style="margin-bottom: 20px"
              >
                <el-select
                  v-model="item.api"
                  placeholder="请选择"
                  style="width: 400px; margin-right: 10px"
                >
                  <el-option
                    v-for="item1 in triggerConfigList"
                    v-if="item1.type == mainInfo.sortBusiness"
                    :key="item1.value"
                    :label="item1.label"
                    :value="item1.value"
                  >
                  </el-option>
                </el-select>
                <el-button
                  type="primary"
                  icon="el-icon-minus"
                  @click="cfApiRemove(index)"
                ></el-button>
              </div>
            </el-col>
          </el-row>
          <el-row v-show="false">
            <el-col :span="4">
              <el-form-item label="触发启动：">
                <el-button
                  type="primary"
                  icon="el-icon-plus"
                  style="margin-left: 5px"
                  @click="cfqdAdd"
                ></el-button>
              </el-form-item>
            </el-col>
            <el-col :span="20">
              <div
                v-for="(item, index) in taskInfo.startWorkFlow"
                :key="index"
                style="margin-bottom: 20px"
              >
                工作流ID:
                <el-input
                  placeholder="工作流ID"
                  v-model="item.gzlId"
                  style="width: 100px; margin-right: 10px"
                ></el-input>
                启动节点:
                <el-input
                  placeholder="启动节点"
                  v-model="item.qdNode"
                  style="width: 80px; margin-right: 10px"
                ></el-input>
                启动角色:
                <el-select v-model="item.qdRole.type" placeholder="请选择">
                  <el-option
                    v-for="item1 in [
                      { value: '', label: '无' },
                      { value: '角色', label: '角色' },
                      { value: '单位角色', label: '单位角色' },
                      { value: '部门角色', label: '部门角色' },
                      { value: '指定角色', label: '指定角色' },
                    ]"
                    :key="item1.value"
                    :label="item1.label"
                    :value="item1.value"
                  >
                  </el-option>
                </el-select>

                <!-- <span v-if="item.qdRole.type=='部门'">
                    部门配置：
                    <el-input :value="getDeptNames(item.qdRole.depts)" @click.native="SelectDept(index,'qdBmName',item.qdRole.depts)" :readonly="true" style="width:200px"></el-input>
                </span>
                <span v-else-if="item.qdRole.type=='人员'">
                    人员配置：
                    <el-input
                        :value="getUserNames(item.qdRole.users)"
                        @click.native="SelectPeople(index,item.qdRole.users)"
                        readonly="readonly"
                        style="width:200px"
                    ></el-input>
                </span> -->
                <span v-if="item.qdRole.type == '角色'">
                  角色配置：
                  <el-select
                    v-model="item.qdRole.roles"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.qdRole.type == '单位角色'">
                  单位角色：
                  <el-select
                    v-model="item.qdRole.rolesDw"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.qdRole.type == '部门角色'">
                  部门角色：
                  <el-select
                    v-model="item.qdRole.rolesBm"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                <span v-else-if="item.qdRole.type == '指定角色'">
                  指定角色：
                  <el-select
                    v-model="item.qdRole.rolesZd"
                    multiple
                    placeholder="请选择"
                    style="width: 200px"
                  >
                    <el-option
                      v-for="(item, index) in RoleValue"
                      :key="index"
                      :label="item.roleName"
                      :value="item.roleId"
                    >
                    </el-option>
                  </el-select>
                </span>
                表单数据:
                <span v-if="item.formDataCs == 'false'">
                  <el-button
                    type="success"
                    plain
                    size="mini"
                    @click="sjcs(index)"
                    >允许</el-button
                  >
                </span>
                <span v-else>
                  <el-button
                    type="warning"
                    plain
                    size="mini"
                    @click="sjcs(index)"
                    >禁止</el-button
                  >
                </span>
                <el-button
                  type="primary"
                  icon="el-icon-minus"
                  style="margin-left: 10px"
                  @click="cfqdRemove(index)"
                ></el-button>
              </div>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="6">
              <el-form-item label="超时设置：">
                <el-input-number
                  v-model="taskInfo.timeLimit"
                  :min="0"
                  :max="8760"
                  style="width: 120px"
                ></el-input-number>
                小时
              </el-form-item>
            </el-col>
            <el-col :span="6" v-show="taskInfo.timeLimit > 0" v-if="false">
              <el-form-item label="自动审批：">
                <el-select v-model="taskInfo.autoApproval" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: false, label: '不自动审批' },
                      { value: true, label: '超时自动审批' },
                    ]"
                    :key="item.index"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="6" v-show="taskInfo.timeLimit > 0" v-if="false">
              <el-form-item label="提醒时限：">
                <el-input-number
                  v-model="taskInfo.remindTime"
                  :min="0"
                  :max="72"
                  style="width: 120px"
                ></el-input-number>
                小时
              </el-form-item>
            </el-col>
            <el-col
              :span="6"
              v-show="taskInfo.timeLimit > 0 && taskInfo.remindTime > 0"
            >
              <el-form-item label="提醒方式：">
                <el-select
                  v-model="taskInfo.remindType"
                  placeholder="请选择"
                  :disabled="true"
                >
                  <el-option
                    v-for="item in [
                      { value: '', label: '无' },
                      { value: '消息', label: '消息' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="4">
              <el-form-item label="逾期提醒：">
                <el-select v-model="taskInfo.exceedType" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '', label: '不提醒' },
                      { value: '0', label: '逾期当天之后' },
                      { value: '1', label: '逾期一天后' },
                      { value: '2', label: '逾期两天后' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5" v-show="taskInfo.exceedType != ''">
              <el-form-item label="提醒自己：">
                <el-select v-model="taskInfo.exceedTypeGr" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '是', label: '提醒自己' },
                      { value: '否', label: '不提醒自己' },
                    ]"
                    :key="item.index"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5" v-show="taskInfo.exceedType != ''">
              <el-form-item label="提醒部门：">
                <el-select v-model="taskInfo.exceedTypeBm" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '是', label: '提醒部门领导' },
                      { value: '否', label: '不提醒部门领导' },
                    ]"
                    :key="item.index"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5" v-show="taskInfo.exceedType != ''">
              <el-form-item label="提醒单位：">
                <el-select v-model="taskInfo.exceedTypeDw" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '是', label: '提醒单位领导' },
                      { value: '否', label: '不提醒单位领导' },
                    ]"
                    :key="item.index"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="5" v-show="taskInfo.exceedType != ''">
              <el-form-item label="提醒发起：">
                <el-select v-model="taskInfo.exceedTypeFq" placeholder="请选择">
                  <el-option
                    v-for="item in [
                      { value: '是', label: '提醒审批发起人' },
                      { value: '否', label: '不提醒审批发起人' },
                    ]"
                    :key="item.index"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="12" v-show="false">
              <el-form-item label="授权开关：">
                <el-select
                  v-model="taskInfo.empowerSwitch"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: false, label: '不可授权' },
                      { value: true, label: '可以授权' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="盖章（契约锁）：">
                <el-select
                  v-model="taskInfo.wordQys"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: '是', label: '可以盖章' },
                      { value: '否', label: '不可盖章' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-show="taskInfo.wordQys == '是'">
              <el-form-item label="盖章附件：">
                <el-input
                  placeholder="附件名称（附件分类名称），可为空"
                  v-model="taskInfo.wordQysFj"
                  style="width: 300px; margin-right: 10px"
                ></el-input>
              </el-form-item>
            </el-col>
            <el-col :span="8">
              <el-form-item label="审批打印：">
                <el-select
                  v-model="taskInfo.isPrint"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: true, label: '打印此审批环节' },
                      { value: false, label: '不打印此审批环节' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="12" v-show="false">
              <el-form-item label="文档生成：">
                <el-select
                  v-model="taskInfo.wordCreate"
                  placeholder="请选择"
                  :disabled="taskInfo.isRoot"
                >
                  <el-option
                    v-for="item in [
                      { value: true, label: '自动生成' },
                      { value: false, label: '禁止生成' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-show="!isEnd"> </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="8">
              <el-form-item label="默认表单：">
                <el-select
                  v-model="taskInfo.defaultForP"
                  placeholder="请选择"
                  style="width: 200px"
                >
                  <el-option
                    v-for="item in [
                      { value: false, label: '不使用默认的表单或程序' },
                      { value: true, label: '使用默认的表单或程序' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-show="taskInfo.defaultForP == false">
              <el-form-item label="表单或程序：">
                <el-select
                  v-model="taskInfo.formOrProgram"
                  placeholder="请选择"
                >
                  <el-option
                    v-for="item in [
                      { value: '公共表单', label: '公共表单' },
                      { value: '独立程序', label: '独立程序' },
                      { value: '说明展示', label: '说明展示' },
                    ]"
                    :key="item.value"
                    :label="item.label"
                    :value="item.value"
                  >
                  </el-option>
                </el-select>
              </el-form-item>
            </el-col>
            <el-col :span="8" v-show="taskInfo.defaultForP == false">
              <el-form-item label="程序接口：">
                <el-input
                  placeholder="程序接口"
                  v-model="taskInfo.programInterface"
                  style="width: 200px"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
          <el-row v-if="false" v-show="taskInfo.defaultForP == false">
            <el-form-item label="表单属性：">
              <el-table
                :data="taskInfo.formInfo"
                border
                stripe
                fit
                style="width: 98%"
              >
                <el-table-column prop="name" label="名称" width="150">
                </el-table-column>
                <el-table-column prop="type" label="类型" width="150">
                </el-table-column>
                <el-table-column prop="comment" label="注释" width="180">
                </el-table-column>
                <el-table-column prop="comment" label="说明">
                  <template slot-scope="scope">
                    <div
                      v-if="
                        scope.row.fieldValue != null &&
                        scope.row.fieldValue !== '{}'
                      "
                    >
                      {{ getTYpe(scope.row.fieldValue) }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column label="设置" align="center" width="250">
                  <template slot-scope="scope">
                    <div
                      v-if="
                        scope.row.fieldValue != null &&
                        scope.row.fieldValue !== '{}'
                      "
                    >
                      <el-checkbox
                        label="必选"
                        v-model="scope.row.required"
                        @change="setXz(1, scope.row.required, scope.row)"
                      ></el-checkbox>
                      <el-checkbox
                        label="只读"
                        v-model="scope.row.disabled"
                        @change="setXz(2, scope.row.disabled, scope.row)"
                      ></el-checkbox>
                      <el-checkbox
                        label="隐藏"
                        v-model="scope.row.hidden"
                        @change="setXz(3, scope.row.hidden, scope.row)"
                      ></el-checkbox>
                    </div>
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
          </el-row>
          <el-row
            v-if="false"
            v-show="
              taskInfo.defaultForP == false &&
              taskInfo.formInfoDetailed.length > 0
            "
          >
            <el-form-item label="明细属性：">
              <el-table
                :data="taskInfo.formInfoDetailed"
                border
                style="width: 98%"
              >
                <el-table-column prop="name" label="名称" width="150">
                </el-table-column>
                <el-table-column prop="type" label="类型" width="150">
                </el-table-column>
                <el-table-column prop="comment" label="注释" width="180">
                </el-table-column>
                <el-table-column prop="comment" label="说明">
                  <template slot-scope="scope">
                    <div
                      v-if="
                        scope.row.fieldValue != null &&
                        scope.row.fieldValue !== '{}'
                      "
                    >
                      {{ getTYpe(scope.row.fieldValue) }}
                    </div>
                  </template>
                </el-table-column>
                <el-table-column prop="bid" label="BID" width="120">
                </el-table-column>
                <el-table-column label="设置" align="center" width="250">
                  <template slot-scope="scope">
                    <div
                      v-if="
                        scope.row.fieldValue != null &&
                        scope.row.fieldValue !== '{}'
                      "
                    >
                      <el-checkbox
                        label="必选"
                        v-model="scope.row.required"
                        @change="setXz(1, scope.row.required, scope.row)"
                      ></el-checkbox>
                      <el-checkbox
                        label="只读"
                        v-model="scope.row.disabled"
                        @change="setXz(2, scope.row.disabled, scope.row)"
                      ></el-checkbox>
                      <el-checkbox
                        label="隐藏"
                        v-model="scope.row.hidden"
                        @change="setXz(3, scope.row.hidden, scope.row)"
                      ></el-checkbox>
                    </div>
                  </template>
                </el-table-column>
              </el-table>
            </el-form-item>
          </el-row>
          <el-row v-show="!isEnd" v-if="false">
            <el-col :span="24">
              <el-form-item label="操作说明：">
                <el-input
                  placeholder="请输入节点操作说明"
                  v-model="taskInfo.taskExplain"
                  type="textarea"
                  :autosize="{ minRows: 4, maxRows: 6 }"
                ></el-input>
              </el-form-item>
            </el-col>
          </el-row>
        </el-form>
      </div>
      <span slot="footer" class="dialog-footer">
        <el-button type="primary" @click="save">保存节点</el-button>
        <el-button type="primary" plain @click="isVisiable = false"
          >取消</el-button
        >
      </span>
    </el-dialog>

    <!--机构负责人-->
    <check-user-all
      ref="checkUserAll"
      :multiple="false"
      :roleCode="null"
      :userIds="userAllIds"
      @getUserList="renyuanbianliE1"
    ></check-user-all>
  </div>
</template>

<script>
/**
 * 工作流节点配置
 * @author GeGe
 * @time ---
 */
import { getObj, putObj } from "@/api/workflow/wfflowconfig";
import { deptRoleList } from "@/api/admin/role";
import { Message } from "element-ui";
import checkUserAll from "@/components/form/compound/selectUser";

export default {
  components: { checkUserAll },
  data() {
    return {
      isVisiable: false,
      isEnd: false,
      mainInfo: {},
      flowConfigNode: {},
      taskId: "",
      taskData: {},
      taskList: [],
      taskInfo: {
        taskId: "", //节点ID*
        taskCode: "", //节点Code*
        taskName: "", //节点名称*
        progress: 1, // 节点所占流程的比例
        isRoot: false, //是否启动节点*
        isPrint: true, //节点是否打印
        rootRole: [], //启动节点人员配置
        taskType: "普通", //节点类型（普通、会签、传阅）*
        circulateConfig: "", //传阅配置*
        handleType: "办理", //操作类型（申请、审核、审批、办理）*
        handleButton: "提交", //办理按钮名称*
        handleText: "同意。", //办理默认文本*
        TextSwitch: false, //批注开关*
        buttonConfig: [], //按钮配置
        backSwitch: false, //退回开关*
        backMode: false, //退回模式*
        backList: [], //退回节点列表*
        skipSwitch: false, //去重开关*
        transferSwitch: false, //转办开关*
        transferConfig: "", //转办配置*
        revokeSwitch: false, //撤销开关*
        recallSwitch: true, //撤回开关
        personnelConfig: {
          //人员配置
          type: "", //部门、人员、角色、单位角色、部门角色、指定角色、发起人相关、办理人相关、节点相关
          depts: [],
          users: [],
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
          originator: [],
          transactor: [],
          tasks: [],
        },
        personnelConfig2: {
          //人员配置2
          type: "", //部门、人员、角色、单位角色、部门角色、指定角色、发起人相关、办理人相关、节点相关
          depts: [],
          users: [],
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
          originator: [],
          transactor: [],
          tasks: [],
        },
        taskExplain: "", //节点说明*
        attachFileConfig: [], //附件配置
        attachmentHeight: 0, //附件高度
        verificationConfig: [], //验证配置
        copyInfoConfig: {
          //抄送配置
          type: "", //部门、人员、角色、单位角色、部门角色、指定角色、发起人相关、办理人相关、节点相关
          depts: [],
          users: [],
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
          originator: [],
          transactor: [],
          tasks: [],
        },
        copyInfoConfigList: [], //抄送（新）
        triggerConfig: [], //后续触发接口配置
        startWorkFlow: [
          //后续触发启动配置
        ],
        timeLimit: 0, //超时设置*
        autoApproval: false, //自动审批*
        remindTime: 0, //提醒时限*
        remindType: "消息", //提醒方式（消息、短信）*

        exceedType: "0",
        exceedTypeGr: "是",
        exceedTypeBm: "是",
        exceedTypeDw: "是",
        exceedTypeFq: "是",

        empowerSwitch: false, //授权办理开关*
        wordQys: "否", //契约锁
        wordQysFj: "", //契约锁附件
        wordCreate: false, //文档生成开关
        defaultForP: false, //是否使用默认的表单或程序
        formOrProgram: "独立程序", //表单或程序
        programInterface: "", //程序入口
        formInfo: [], //表单信息
        formInfoDetailed: [], //明细信息
      },
      RoleValue: [], //角色
      programInterfaceList: [
        //环节办理
        { type: "yjhtzbsh", label: "业绩合同-合同创建", value: "yjhthtcj" },
        { type: "yjhtzbsh", label: "业绩合同-指标拟定", value: "yjhtzbnd" },
        { type: "yjhtzbsh", label: "业绩合同-确认指标", value: "yjhtqrzb" },
        { type: "yjhtzbsh", label: "业绩合同-合同汇总", value: "yjhththz" },
        { type: "jjfp", label: "奖金分配业务-查看审批", value: "jjfpCksp" },
        {
          type: "jjff",
          label: "奖金发放业务-查看审批(简表)",
          value: "jjffCksp1",
        },
        {
          type: "jjff",
          label: "奖金发放业务-查看审批(详表)",
          value: "jjffCksp2",
        },
      ],
      triggerConfigList: [],
      //发起人相关
      originatorList: [
        { id: "单位领导-单位负责人", name: "单位领导-单位负责人" },
        { id: "部门人员-部门负责人", name: "部门人员-部门负责人" },
        { id: "部门人员-部门所有人", name: "部门人员-部门所有人" },
        { id: "部门人员-流程发起人", name: "部门人员-流程发起人" },
      ],
      //办理人相关
      transactorList: [
        { id: "单位领导-单位负责人", name: "单位领导-单位负责人" },
        { id: "部门人员-部门负责人", name: "部门人员-部门负责人" },
        { id: "部门人员-部门所有人", name: "部门人员-部门所有人" },
        { id: "部门人员-当前办理人", name: "部门人员-当前办理人" },
      ],
      lineDatas: [], //线形数据
      tasksList: [], //节点相关
      renyuanbianliE: null,
      userAllIds: [],
    };
  },
  created: function () {},
  mounted() {},
  methods: {
    init(id, taskId, taskData) {
      this.mainInfo = {};
      this.taskId = taskId;
      this.taskData = taskData;
      this.isEnd = false; //是否结束点
      this.taskInfo = {
        taskId: "", //节点ID
        taskCode: "", //节点Code
        taskName: "", //节点名称
        progress: 1, // 节点所占流程的比例
        isRoot: false, //是否启动节点
        isPrint: true, //节点是否打印
        rootRole: [], //启动节点人员配置
        taskType: "普通", //节点类型（普通、会签、传阅）
        circulateConfig: "", //传阅配置
        handleType: "办理", //操作类型（申请、审核、审批、办理）
        handleButton: "提交", //办理按钮名称
        handleText: "同意。", //办理默认文本
        TextSwitch: false, //批注开关*
        buttonConfig: [], //按钮配置
        backSwitch: false, //退回开关
        backMode: false, //退回模式*
        backList: [], //退回节点列表
        skipSwitch: false, //去重开关
        transferSwitch: false, //转办开关
        transferConfig: "", //转办配置
        revokeSwitch: false, //撤销开关
        recallSwitch: true, //撤回开关
        personnelConfig: {
          //人员配置
          type: "", //部门、人员、角色、单位角色、部门角色、指定角色、发起人相关、办理人相关、节点相关
          depts: [],
          users: [],
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
          originator: [],
          transactor: [],
          tasks: [],
        },
        personnelConfig2: {
          //人员配置2
          type: "", //部门、人员、角色、单位角色、部门角色、指定角色、发起人相关、办理人相关、节点相关
          depts: [],
          users: [],
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
          originator: [],
          transactor: [],
          tasks: [],
        },
        taskExplain: "", //节点说明
        attachFileConfig: [], //附件配置
        attachmentHeight: 0, //附件高度
        verificationConfig: [], //验证配置
        copyInfoConfig: {
          //抄送配置
          type: "", //部门、人员、角色、单位角色、部门角色、指定角色、发起人相关、办理人相关、节点相关
          depts: [],
          users: [],
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
          originator: [],
          transactor: [],
          tasks: [],
        },
        copyInfoConfigList: [], //抄送（新）
        triggerConfig: [], //后续触发接口配置
        startWorkFlow: [
          //后续触发启动配置
        ],
        timeLimit: 0, //超时设置
        autoApproval: false, //自动审批
        remindTime: 0, //提醒时限
        remindType: "消息", //提醒方式（消息、短信）

        exceedType: "0",
        exceedTypeGr: "是",
        exceedTypeBm: "是",
        exceedTypeDw: "是",
        exceedTypeFq: "是",

        empowerSwitch: false, //授权办理开关
        wordQys: "否", //契约锁
        wordQysFj: "", //契约锁附件
        wordCreate: false, //文档生成开关
        defaultForP: false, //是否使用默认的表单或程序
        formOrProgram: "独立程序", //表单或程序
        programInterface: "", //程序入口
        formInfo: [], //表单信息
        formInfoDetailed: [], //明细信息
        submitUp: "", //提交开始时间
        submitEnd: "", //提交结束时间
      };
      //获取角色
      deptRoleList().then((response) => {
        let data = response.data.data;
        this.RoleValue = data;
      });
      getObj(id)
        .then((res) => {
          if (res.data.code == "0") {
            this.mainInfo = res.data.data;
            this.isVisiable = true;

            if (this.notNull(this.mainInfo.flowConfigNode)) {
              this.flowConfigNode = JSON.parse(this.mainInfo.flowConfigNode);

              if (this.flowConfigNode[taskId] != undefined) {
                for (var i in this.flowConfigNode[taskId]) {
                  this.taskInfo[i] = this.flowConfigNode[taskId][i];
                }
              }
            }

            if (!this.taskInfo.isRoot) {
              this.ryData = this.taskInfo.personnelConfig; //人员配置数据
            }
            this.csData = this.taskInfo.copyInfoConfig; //抄送配置数据
            this.taskInfo.taskId = taskData.id;
            this.taskInfo.taskName = taskData.businessObject.name;

            var flowConfigLine = JSON.parse(this.mainInfo.flowConfigLine);
            this.tasksList = [];
            for (var i in flowConfigLine.Task) {
              this.tasksList.push({
                taskId: flowConfigLine[flowConfigLine.Task[i]].id,
                taskName: flowConfigLine[flowConfigLine.Task[i]].name,
              });
            }
            if (flowConfigLine.StartTask.indexOf(taskId) != -1) {
              this.taskInfo.isRoot = true;
              if (this.flowConfigNode[taskId] == undefined) {
                this.taskInfo.handleType = "申请";
                this.taskInfo.handleButton = "申请";
                this.taskInfo.handleText = "同意。";
                this.taskInfo.revokeSwitch = true;
              }
            }
            if (flowConfigLine.EndEvent.indexOf(taskId) != -1) {
              this.isEnd = true;
            }
            if (this.taskInfo.formOrProgram == "") {
              this.taskInfo.formOrProgram = this.mainInfo.formOrProgram;
            }
            if (this.taskInfo.programInterface == "") {
              //this.taskInfo.programInterface = this.mainInfo.programInterface;
            }

            if (this.taskInfo.formInfo == null) {
              this.taskInfo.formInfo = [];
            }
            if (this.taskInfo.formInfo.length == 0) {
              this.taskInfo.formInfo = JSON.parse(this.mainInfo.formInfo);
            } else {
              var formInfo = [];
              var FIS = JSON.parse(this.mainInfo.formInfo);
              for (var i in FIS) {
                formInfo[i] = FIS[i];
                for (var j in this.taskInfo.formInfo) {
                  if (this.taskInfo.formInfo[j].name == formInfo[i].name) {
                    formInfo[i].required = this.taskInfo.formInfo[j].required;
                    formInfo[i].disabled = this.taskInfo.formInfo[j].disabled;
                    formInfo[i].hidden = this.taskInfo.formInfo[j].hidden;
                  }
                }
              }
              this.taskInfo.formInfo = formInfo;
            }
            if (this.taskInfo.formInfoDetailed == null) {
              this.taskInfo.formInfoDetailed = [];
            }

            if (this.taskInfo.formInfoDetailed.length == 0) {
              this.taskInfo.formInfoDetailed = JSON.parse(
                this.mainInfo.formInfoDetailed
              );
            } else {
              var formInfoDetailed = [];
              var FIDS = JSON.parse(this.mainInfo.formInfoDetailed);
              for (var i in FIDS) {
                formInfoDetailed[i] = FIDS[i];
                for (var j in this.taskInfo.formInfoDetailed) {
                  if (
                    this.taskInfo.formInfoDetailed[j].name ==
                    formInfoDetailed[i].name
                  ) {
                    formInfoDetailed[i].required =
                      this.taskInfo.formInfoDetailed[j].required;
                    formInfoDetailed[i].disabled =
                      this.taskInfo.formInfoDetailed[j].disabled;
                    formInfoDetailed[i].hidden =
                      this.taskInfo.formInfoDetailed[j].hidden;
                  }
                }
              }
              this.taskInfo.formInfoDetailed = formInfoDetailed;
            }
            this.taskList = [];
            for (var x in flowConfigLine.Task) {
              this.taskList.push({
                value: flowConfigLine.Task[x],
                label: flowConfigLine[flowConfigLine.Task[x]].name,
              });
            }
          } else {
            this.$message({
              type: "error",
              message: res.msg,
            });
          }
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "操作错误",
          });
        });
    },
    notNull(data) {
      if (typeof data == "sring") {
        if (data != null && data != "" && data != undefined) {
          return true;
        } else {
          return false;
        }
      } else {
        if (data != null && data != "" && data != undefined) {
          return true;
        } else {
          return false;
        }
      }
    },
    querySearch(queryString, cb) {
      var results = [
        { value: "同意。" },
        { value: "已按要求完成表单填写。" },
        { value: "审核通过，无意见。" },
        { value: "审批通过，无意见。" },
        { value: "已按要求完成工作办理。" },
        { value: "已按要求查阅工作办理情况。" },
      ];
      // 调用 callback 返回建议列表的数据
      cb(results);
    },
    getTYpe(e) {
      var fieldValue = JSON.parse(e);
      if (fieldValue.type == "dynamicListEl") {
        return fieldValue.type + "（bid:" + fieldValue.value + "）";
      } else {
        return fieldValue.type;
      }
    },
    setXz(i, z, r) {
      if (z) {
        if (i == 1) {
          r.disabled = false;
          r.hidden = false;
        } else if (i == 2) {
          r.required = false;
          r.hidden = false;
        } else if (i == 3) {
          r.disabled = false;
          r.required = false;
        }
      }
    },
    save() {
      //****验证start */
      //启动角色验证

      //按钮配置验证
      var anyz = "";
      for (var index in this.taskInfo.buttonConfig) {
        if (this.taskInfo.buttonConfig[index].buttonName == "") {
          anyz = "请补全按钮配置第" + (parseInt(index) + 1) + "条";
          break;
        } else {
          if (
            this.taskInfo.buttonConfig[index].buttonType == "传递" &&
            this.taskInfo.buttonConfig[index].taskId == ""
          ) {
            anyz = "请补全按钮配置第" + (parseInt(index) + 1) + "条";
            break;
          }
          if (
            this.taskInfo.buttonConfig[index].buttonType == "程度" &&
            this.taskInfo.buttonConfig[index].praName == ""
          ) {
            anyz = "请补全按钮配置第" + (parseInt(index) + 1) + "条";
            break;
          }
        }
      }
      var qdjsyz = "";
      if (this.taskInfo.isRoot && this.taskInfo.rootRole == null) {
        qdjsyz = "请选择启动角色";
      }
      //人员配置验证
      var ryyz = "";
      var ryyz2 = "";
      if (!this.taskInfo.isRoot && !this.isEnd) {
        var rydata = this.taskInfo.personnelConfig;
        var rydata2 = this.taskInfo.personnelConfig2;
        ryyz = this.rycsyz(rydata, "人员配置");
        if (rydata2.type != "") {
          ryyz2 = this.rycsyz(rydata2, "人员配置");
        }
      }
      //抄送配置验证
      var csyz = "";
      var csdata = this.taskInfo.copyInfoConfig;
      if (csdata.type != "") {
        csyz = this.rycsyz(csdata, "抄送配置");
      }

      //附件配置验证
      var fjyz = "";
      for (var index in this.taskInfo.attachFileConfig) {
        if (this.taskInfo.attachFileConfig[index].fjName == "") {
          fjyz = "请补全附件配置第" + (parseInt(index) + 1) + "条";
          break;
        }
      }
      //验证配置验证
      var yzyz = "";
      for (var index in this.taskInfo.verificationConfig) {
        var yzLx = this.taskInfo.verificationConfig[index].yzLx;
        if (yzLx == "") {
          yzyz = "请补全验证配置第" + (parseInt(index) + 1) + "条";
          break;
        } else {
          var yzpd = "";
          if (
            yzLx == "前端" &&
            this.taskInfo.verificationConfig[index].frontApi == ""
          ) {
            yzpd = "符合";
          } else if (
            yzLx == "后端" &&
            this.taskInfo.verificationConfig[index].backApi == ""
          ) {
            yzpd = "符合";
          } else if (
            yzLx == "自定义" &&
            this.taskInfo.verificationConfig[index].zdy == ""
          ) {
            yzpd = "符合";
          }
          if (yzpd != "") {
            yzyz = "请补全验证配置第" + (parseInt(index) + 1) + "条";
            break;
          }
        }
      }
      //触发接口
      var cfyz = "";
      for (var index in this.taskInfo.triggerConfig) {
        if (this.taskInfo.triggerConfig[index].api == "") {
          cfyz = "请补全触发接口第" + (parseInt(index) + 1) + "条";
          break;
        }
      }
      //触发启动
      var qdyz = "";
      for (var index in this.taskInfo.startWorkFlow) {
        var jsType = this.taskInfo.startWorkFlow[index].qdRole.type;
        if (
          this.taskInfo.startWorkFlow[index].gzlId == "" ||
          this.taskInfo.startWorkFlow[index].qdNode == "" ||
          jsType == ""
        ) {
          qdyz = "请补全触发启动第" + (parseInt(index) + 1) + "条";
          break;
        } else {
          var qdpd = "";
          if (
            jsType == "部门" &&
            this.taskInfo.startWorkFlow[index].qdRole.depts == null
          ) {
            qdpd = "符合";
          } else if (
            jsType == "人员" &&
            this.taskInfo.startWorkFlow[index].qdRole.users == null
          ) {
            qdpd = "符合";
          } else if (
            jsType == "角色" &&
            this.taskInfo.startWorkFlow[index].qdRole.roles == null
          ) {
            qdpd = "符合";
          } else if (
            jsType == "单位角色" &&
            this.taskInfo.startWorkFlow[index].qdRole.rolesDw == null
          ) {
            qdpd = "符合";
          } else if (
            jsType == "指定角色" &&
            this.taskInfo.startWorkFlow[index].qdRole.rolesZd == null
          ) {
            qdpd = "符合";
          }
          if (qdpd != "") {
            qdyz = "请补全触发启动第" + (parseInt(index) + 1) + "条";
            break;
          }
        }
      }
      //环节办理
      var hjbl = "";
      if (!this.taskInfo.programInterface) {
        hjbl = "没有选择环节办理的内容组件";
      }
      var taskMessage = "";
      if (qdjsyz != "") {
        taskMessage = qdjsyz;
      } else if (ryyz != "") {
        taskMessage = ryyz;
      } else if (ryyz2 != "") {
        taskMessage = ryyz2;
      } else if (csyz != "") {
        taskMessage = csyz;
      } else if (anyz != "") {
        taskMessage = anyz;
      } else if (fjyz != "") {
        taskMessage = fjyz;
      } else if (yzyz != "") {
        taskMessage = yzyz;
      } else if (cfyz != "") {
        taskMessage = cfyz;
      } else if (qdyz != "") {
        taskMessage = qdyz;
      } else if (hjbl != "") {
        taskMessage = hjbl;
      }
      if (taskMessage != "") {
        Message({
          message: taskMessage,
          type: "error",
          duration: 3 * 1000,
        });
        return;
      }
      //****验证end */
      this.flowConfigNode[this.taskId] = this.taskInfo;
      //增加表单验证...
      this.$confirm("此操作将保存该节点的配置信息, 是否继续?", "提示", {
        confirmButtonText: "确定",
        cancelButtonText: "取消",
        type: "warning",
      })
        .then(() => {
          putObj({
            id: this.mainInfo.id,
            flowConfigNode: JSON.stringify(this.flowConfigNode, null, 2),
          })
            .then((res) => {
              if (res.data.code == "0") {
                Message({
                  message: "配置信息保存成功...",
                  type: "success",
                  duration: 3 * 1000,
                });
                this.isVisiable = false;
              } else {
                Message({
                  message: res.msg,
                  type: "error",
                  duration: 3 * 1000,
                });
              }
            })
            .catch((error) => {
              //console.log(error);
            });
        })
        .catch(() => {
          this.$message({
            type: "info",
            message: "已取消操作",
          });
        });
    },
    //附件标准添加
    fjAdd() {
      this.taskInfo.attachFileConfig.push({
        fjName: "",
        fjLx: "",
        fjXz: "否",
        fjGz: "否",
      });
    },
    //附件标准移除
    fjRemove(index) {
      this.taskInfo.attachFileConfig.splice(index, 1);
    },
    //按钮添加
    buttonAdd() {
      this.taskInfo.buttonConfig.push({
        buttonName: "",
        buttonType: "传递",
        taskId: "",
        praName: "",
      });
    },
    //按钮移除
    buttonRemove(index) {
      this.taskInfo.buttonConfig.splice(index, 1);
    },
    //验证添加
    yzAdd() {
      this.taskInfo.verificationConfig.push({
        yzLx: "",
        frontApi: "",
        backApi: "",
        zdy: "",
      });
    },
    //验证移除
    yzRemove(index) {
      this.taskInfo.verificationConfig.splice(index, 1);
    },
    //触发接口添加
    cfApiAdd() {
      this.taskInfo.triggerConfig.push({
        api: "",
      });
    },
    //触发接口移除
    cfApiRemove(index) {
      this.taskInfo.triggerConfig.splice(index, 1);
    },
    //触发启动添加
    cfqdAdd() {
      this.taskInfo.startWorkFlow.push({
        gzlId: null,
        qdNode: "",
        qdRole: {
          type: "", //部门、人员、角色、单位角色、指定角色、
          depts: [],
          deptNames: "",
          users: [],
          userNames: "",
          roles: [],
          rolesDw: [],
          rolesBm: [],
          rolesZd: [],
        },
        formDataCs: "false",
      });
    },
    //触发启动移除
    cfqdRemove(index) {
      this.taskInfo.startWorkFlow.splice(index, 1);
    },
    //抄送添加
    cslistAdd() {
      this.taskInfo.copyInfoConfigList.push({
        type: "", //部门、人员、角色、单位角色、指定角色、
        depts: [],
        deptNames: "",
        users: [],
        userNames: "",
        roles: [],
        rolesDw: [],
        rolesBm: [],
        rolesZd: [],
      });
    },
    //抄送移除
    cslistRemove(index) {
      this.taskInfo.copyInfoConfigList.splice(index, 1);
    },
    //表单数据传输
    sjcs(index) {
      if (this.taskInfo.startWorkFlow[index].formDataCs == "false") {
        this.taskInfo.startWorkFlow[index].formDataCs = "true";
      } else {
        this.taskInfo.startWorkFlow[index].formDataCs = "false";
      }
    },

    SelectDept(type1, type2, changeDept) {
      //部门选择
      //this.$refs.xzbms.init_bm(changeDept,type1,type2);
    },
    SelectPeople(type, index, changePeople) {
      //人员选择
      var ids = "";
      for (var i in changePeople) {
        ids += (ids == "" ? "" : ",") + changePeople[i].userId;
      }
      var that = this;
      this.renyuanbianliE = function (data) {
        var schangePeople = [];
        for (var i in data) {
          var element = data[i];
          schangePeople.push({
            userName: element.ryname,
            userId: element.userId,
          });
        }
        if (type == "copyInfoConfigList") {
          that.taskInfo.copyInfoConfigList[index].users = schangePeople;
        }
        if (type == "copyInfoConfig") {
          that.taskInfo.copyInfoConfig.users = schangePeople;
        }
      };

      this.$refs.xzry.init(ids, type);
    },

    //人员返回数据
    renyuanbianli(data, returnId) {
      this.renyuanbianliE(data);
      // var a = "";
      // if(returnId=="ryUserId"){
      //     this.taskInfo.personnelConfig.users=[];
      //     for(var i in data)
      //     {
      //         var element = data[i]
      //         this.taskInfo.personnelConfig.users.push({
      //             userName:element.ryname,
      //             userId:element.userId,
      //         })
      //     };
      // }else if(returnId=="csUserId"){
      //     this.taskInfo.copyInfoConfig.users=[];
      //     data.forEach(element => {
      //         this.taskInfo.copyInfoConfig.users.push({
      //             userName:element.ryname,
      //             userId:element.userId,
      //         })
      //     });
      // }else{
      //     this.taskInfo.startWorkFlow[returnId].qdRole.users=[];
      //     data.forEach(element => {
      //         this.taskInfo.startWorkFlow[returnId].qdRole.users.push({
      //             userName:element.ryname,
      //             userId:element.userId,
      //         })
      //     });
      // }
    },
    //部门树返回值
    returnData(returnId, returnName, selectData) {
      if (returnName == "ryBmName") {
        this.taskInfo.personnelConfig.depts = [];
        for (var index in selectData) {
          this.taskInfo.personnelConfig.depts.push({
            id: selectData[index].id,
            deptName: selectData[index].deptName,
          });
        }
      } else if (returnName == "csBmName") {
        this.taskInfo.copyInfoConfig.depts = [];
        for (var index in selectData) {
          this.taskInfo.copyInfoConfig.depts.push({
            id: selectData[index].id,
            deptName: selectData[index].deptName,
          });
        }
      } else if (returnName == "qdBmName") {
        this.taskInfo.startWorkFlow[returnId].qdRole.depts = [];
        for (var index1 in selectData) {
          this.taskInfo.startWorkFlow[returnId].qdRole.depts.push({
            id: selectData[index1].id,
            deptName: selectData[index1].deptName,
          });
        }
      }
    },
    //人员/抄送验证
    rycsyz(data, name) {
      var ryyz = "";
      if (data.type == "") {
        ryyz = "请补全" + name;
      } else {
        var rypd = "";
        if (
          data.type == "部门" &&
          (data.depts == null || data.depts.length == 0 || data.depts == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "人员" &&
          (data.users == null || data.users.length == 0 || data.users == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "部门" &&
          (data.depts == null || data.depts.length == 0 || data.depts == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "角色" &&
          (data.roles == null || data.roles.length == 0 || data.roles == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "单位角色" &&
          (data.rolesDw == null ||
            data.rolesDw.length == 0 ||
            data.rolesDw == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "部门角色" &&
          (data.rolesBm == null ||
            data.rolesBm.length == 0 ||
            data.rolesBm == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "指定角色" &&
          (data.rolesZd == null ||
            data.rolesZd.length == 0 ||
            data.rolesZd == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "发起人相关" &&
          (data.originator == null ||
            data.originator.length == 0 ||
            data.originator == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "办理人相关" &&
          (data.transactor == null ||
            data.transactor.length == 0 ||
            data.transactor == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "节点相关" &&
          (data.tasks == null || data.tasks.length == 0 || data.tasks == "")
        ) {
          rypd = "符合";
        } else if (
          data.type == "指定人员" &&
          (data.users == null || data.users.length == 0 || data.users == "")
        ) {
          rypd = "符合";
        }
        if (rypd != "") {
          ryyz = "请补全" + name;
        }
      }
      return ryyz;
    },
    selectUser(users) {
      if (users.length == 0) {
        this.userAllIds = [""];
      } else {
        this.userAllIds = [users[0].userId];
      }
      let that = this;
      this.renyuanbianliE = function (data) {
        that.$set(users, 0, {
          userId: data[0].userId,
          ryName: data[0].ryName,
        });
        // users = [{
        //   userId: data[0].userId,
        //   ryName: data[0].ryName
        // }]
      };
      this.$nextTick(() => {
        this.$refs.checkUserAll.init();
      });
    },
    renyuanbianliE1(data) {
      //console.log(data)
      this.renyuanbianliE(data);
    },
    getStrJoin(strKey, strData) {
      let lTemp = [];
      strData.map((item) => {
        lTemp.push(item[strKey]);
      });
      return lTemp;
    },
    getUserNames(userList) {
      //人员名称
      var names = "";
      for (var i in userList) {
        names += (names == "" ? "" : ",") + userList[i].userName;
      }
      return names;
    },
    getDeptNames(deptList) {
      //部门名称
      var names = "";
      for (var i in deptList) {
        names += (names == "" ? "" : ",") + deptList[i].deptName;
      }
      return names;
    },
  },
};
</script>

<style>
.tasksz .el-dialog__body {
  height: 480px;
}

.containers {
  overflow: auto;
  padding: 10px;
}
</style>
